<?php
$mod = 'blank';
include("../api.inc.php");
$title = '授权管理中心';
include './head.php';
if ($islogin == 1) {
} else exit("<script language='javascript'>window.location.href='./login.php';</script>");
$fwd_kg = $DB->get_row("SELECT * FROM auth_pay WHERE k='fwd_kg'");
$khd_kg = $DB->get_row("SELECT * FROM auth_pay WHERE k='khd_kg'");
$fwd_content = "服务端开关";
$khd_content = "客户端开关";
if ($fwd_kg['v'] == 1) {
    $fwd_content = "关闭服务端验证";
    $fwd_v = 0;
    $fwd_css = "btn-success";

} else {
    $fwd_content = "开启服务端验证";
    $fwd_v = 1;
    $fwd_css = "btn-danger";
}
if ($khd_kg['v'] == 1) {
    $khd_content = "关闭服务端验证";
    $khd_v = 0;
    $khd_css = "btn-success";

} else {
    $khd_content = "开启服务端验证";
    $khd_v = 1;
    $khd_css = "btn-danger";
}
if (isset($_GET['act']) && $_GET['act'] === 'fwd_kg') {
    saveSetting('fwd_kg', $fwd_v);
    $ad = $CACHE->clear();
    if ($ad) {
        exit(showmsg('修改成功！', 1));
    } else {
        exit(showmsg('修改失败！<br/>' . $DB->error(), 4));
    }
}
if (isset($_GET['act']) && $_GET['act'] === 'khd_kg') {
    saveSetting('khd_kg', $khd_v);
    $ad = $CACHE->clear();
    if ($ad) {
        exit(showmsg('修改成功！', 1));
    } else {
        exit(showmsg('修改失败！<br/>' . $DB->error(), 4));
    }
}
?>
    <div class="col-lg-8 col-md-12 col-lg-offset-2 text-center">
        <div class="panel panel-info" draggable="true">
            <div class="panel-heading font-bold">后台管理首页</div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <tbody>
                    <tr height="25">
                        <td align="center">
                            <a href="?act=khd_kg" class="btn btn-sm <?php echo $khd_css; ?>">
                                <i class="glyphicon glyphicon-home"></i>客户端开关：<?php echo $khd_content; ?></a>
                        </td>
                    </tr>
                    <tr height="25">
                        <td align="center">
                            <a href="?act=fwd_kg" class="btn btn-sm <?php echo $fwd_css; ?>">
                                <i
                                        class="glyphicon glyphicon-home"></i>服务端开关：<?php echo $fwd_content; ?></a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php include './foot.php'; ?>